<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/12/24 0024
  Time: 11:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>库房属性设置</title>
    <link rel="stylesheet" href="/bootstrap/bootstrap-5.3.3-dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/css/stock/a/set_storehouse.css" />
    <style type="text/css">

    </style>
</head>
<body>
<div class="panel product">
    <div class="panel-heading hhead">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <span style="color: blue;">您正在做的业务是：</span>
                <li class="breadcrumb-item"><a href="#">库存管理</a></li>
                <li class="breadcrumb-item"><a href="#">客户化设置</a></li>
                <li class="breadcrumb-item"><a href="#">库房设置</a></li>
                <li class="breadcrumb-item active" aria-current="page">库房属性设置</li>
            </ol>
        </nav>
    </div>
    <div style="margin-bottom: 2px">
        <div style="display: inline;margin-left: 95%;">
            <button class="btn btn-primary" id="btnAdd" data-bs-toggle="modal" data-bs-target="#proRegistraModal">添加</button>
        </div>
    </div>
    <div class="panel-body bbody">
        <table id="tab" >
            <thead>
                <tr style="background-color: #e8e8e8;">
                    <td>库房编号</td>
                    <td>库房名称</td>
                    <td>释放</td><!--给个弹框：您确认释放该库房吗？-->
                </tr>
            </thead>
            <tbody id="template" style="display: none">
                <tr>
                    <td class="warehouseId"></td>
                    <td class="warehouseName"></td>
                    <td><a href="">释放</a></td>
                </tr>
            </tbody>
            <tbody id="storeHouseTbl">

            </tbody>
        </table>
    </div>

    <div class="panel-footer ffooter">
        <div id="footerDiv">
            <label style="font-weight: 700;">总数：<span style="color: red;" id="total"></span>例&nbsp;&nbsp;&nbsp;&nbsp;
                当前第<span style="color: red;" id="pageNum"></span>页&nbsp;&nbsp;&nbsp;&nbsp;
                共<span style="color: red;" id="pages"></span>页&nbsp;&nbsp;&nbsp;&nbsp;
            </label>
        </div>

    </div>
</div>

<div class="modal fade" id="proRegistraModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h2>添加库房</h2>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <div id="bodyBox">
                        <form>
                            <table id="tbl">
                                <tr>
                                    <td class="col1">库房编号</td>
                                    <td class="col2"></td>
                                </tr>
                                <tr>
                                    <td class="col1">库房名称</td>
                                    <td class="col2"><input type="text"/></td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button id="btnOK" class="btn btn-danger" data-bs-dismiss="modal">
                    提交<span class="glyphicon glyphicon-remove"></span>
                </button>
                <button id="btnConcel" class="btn btn-danger" data-bs-dismiss="modal">
                    关闭<span class="glyphicon glyphicon-remove"></span>
                </button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/js/jquery-3.7.0.min.js"></script>
<script type="text/javascript" src="/bootstrap/bootstrap-5.3.3-dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
    $(function () {
        initStoreHouse(1);
    })

    function initStoreHouse(pageNum) {
        $.ajax({
            url: "/s-warehouse-setting/initialStoreHouseTbl",
            type: "get",
            dataType: "json",
            success: function (data) {
                console.log(data);
                $("#total").text(data.total);
                $("#pageNum").text(data.pageNum);
                $("#pages").text(data.pages);
                $("#storeHouseTbl").empty();
                let template = $("#template").children();

                $.each(data.list, function (i, storeHouse) {
                    let tr = template.clone();
                    $.each(storeHouse,function (name,value) {
                        if(name=="id"){
                            tr.find(".levelID").val(value);
                            tr.find(".levelID").attr("name",name);
                        }else{
                            tr.find("." + name).text(value);
                        }
                    })
                    $("#storeHouseTbl").append(tr);
                })

            }
        })
    }
</script>
</body>
</html>
